package com.swpu.select.controller;

import com.swpu.select.pojo.Student;
import com.swpu.select.service.StudentService;
import com.swpu.select.service.impl.StudentServiceimpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class StudentController {
    @Autowired
    StudentServiceimpl studentServiceimpl;

    @PostMapping("/getlist")
    public List<Student> getList(){

        return studentServiceimpl.getList();

    }
    @PostMapping("/add")
    public Integer addStudent(@RequestBody Student student){

        return studentServiceimpl.addStudent(student);
    }
    @PostMapping("/update")
    public Integer updateStudent(@RequestBody Student student){
        return studentServiceimpl.updateStudent(student);
    }
    @PostMapping("/delete")
    public Integer deleteStudent(@RequestParam String stuNo){
        return studentServiceimpl.deleteStudent(stuNo);
    }
}